﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Baosight.ZNH.ZMCommon;
using Baosight.Platform.Core.UI.Controls;
using Baosight.Platform.Core;
using Baosight.ZNH.ZMCS.UI.Utils;

namespace Baosight.ZNH.ZMCS.UI
{
    /// <summary>
    /// 设备维护系统设置 
    /// </summary>
    /// Title:ZMCS21
    /// Copyright:Baosight Software LTD.co Copyright (c) 2011
    /// Company:上海宝信软件股份有限公司
    /// Author: 张志芳
    /// Version: 1.0
    /// History:
    ///       2010-12-14  张志芳   [创建]
    ///
    public partial class ZMCS15 : EFViewCmes
    {
        public ZMCS15()
        {
            InitializeComponent();
            base.BeforeAction += OnBeforeAction;
        }
        /// <summary>
        /// Load事件中初始化父类EFViewCmesProperty的值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnBeforeAction(object sender, EventArgs e)
        {
            EFViewCmesProperty _view = new EFViewCmesProperty();
            _view.DataFields = this.InsertPanel.GetChildObjects<EFDataField>(null, true);
            _view.ListPageNo = "ZMCS15";
            _view.ViewType = "details";

            _view.Args.Add("fdModuleNo", this.fdModuleNo.GetDataValue().ToString());

            base.ViewProperty = _view;
        }

        public override void Initialize(EIInfo initData)
        {
            SystemSettingBlock _block = new SystemSettingBlock();
            initData.AddBlock(_block.GetClassLevel());
            initData.AddBlock(_block.GetIsIncludeClass());

            base.Initialize(initData);
            //判断页面时新增页还是编辑页
            InitDataSet(initData);
        }

        /// <summary>
        /// 给Mode付值
        /// </summary>
        /// <param name="initData"></param>
        private void InitDataSet(EIInfo initData)
        {
            Mode = (OperationMode)Enum.Parse(typeof(OperationMode), "Update", true);
        }

        /// <summary>
        /// 点击“修改”按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public override void OnUpdateButtonClick(object sender, RoutedEventArgs e)
        {
            base.OnSureButtonClick(sender, e);
        }

        /// <summary>
        /// 页签切换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void EFTab_SelectionChanged(object sender, RoutedEventArgs e)
        {
            EFTab _tab = sender as EFTab;
            if (null != _tab)
            {
                EFTabItem _item = _tab.SelectedItem as EFTabItem;

                if (null != _item && _item.Name == "BusinessFilterTAB")
                {
                    Dictionary<string, string> _args = new Dictionary<string, string>();
                    //_args.Add("fdModuleNo", this.fdModuleNo.GetDataValue().ToString());
                    _args.Add("fdModuleNo", "ZMCE");
                    this.BusinessFilterTAB.LoadView<EFTabItem>("ZMCS17", _args);//ZMCS17业务过滤页面
                }
            }
        }
    }
}
